﻿using System;
using System.Data;
using System.Data.Odbc;
using System.Windows.Forms;

namespace MedicinskiUslugi {

	public partial class frmAvtomatski : Form {

		public frmAvtomatski() {
			InitializeComponent();
		}

		OdbcConnection dbConnection;

		private void frmAvtomatski_Load( object sender, EventArgs e ) {
			openFolder.ShowDialog();
			dbConnection = new OdbcConnection( "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" + openFolder.SelectedPath + ";Exclusive=No; Collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO;" );
			dbConnection.Open();
			OdbcCommand com = new OdbcCommand( "Select * from obrazecs", dbConnection );
			DataTable dt = new DataTable();
			dt.Load( com.ExecuteReader() );
			dataGridView1.DataSource = dt;

			dbConnection.Close();
		}
	}
}